package com.douxg.fastCoding.randomData;

import java.math.BigDecimal;
import java.util.Random;

/**
 * @Description
 * @Auther douxg
 * @Date 2020/11/12 13:04
 */
public class DoubleRandomData implements RandomData<Double> {
    //保留小数
    private int num = 2;
    //最大值
    private int end = 99;

    private BigDecimal bigDecimal = new BigDecimal(end);

    @Override
    public Double create() {
        return bigDecimal.multiply(new BigDecimal(new Random().nextDouble())).setScale(num, BigDecimal.ROUND_HALF_UP).doubleValue();
    }

    public DoubleRandomData() {

    }

    public DoubleRandomData(int num, int end) {
        this.num = num;
        this.end = end;
    }

    public int getNum() {
        return num;
    }

    public void setNum(int num) {
        this.num = num;
    }

    public int getEnd() {
        return end;
    }

    public void setEnd(int end) {
        this.end = end;
    }
}
